{% extends 'admin_base.html' %}

{% block title2 %}
    发表博文
{% end %}

{% block private_stylesheet %}
    <link rel="stylesheet" type="text/css" media="screen" href="{{ static_url('css/bootstrap-markdown.min.css')}}">
    <link rel="stylesheet" href="{{ static_url('css/highlight/default.min.css') }}" />
{% end %}

{% block admin_content %}
<div class="entry-box submit-article">
    <h4><strong>发表博文</strong></h4>
    <hr/>
    <form class="submit-article" method="post" action="">
        {% module xsrf_form_html() %}
        <div class="form-group">
            <label class="control-label" for="title">标题</label>：
            <select class="" id="source" name="source_id" required="">
                {% for source in SiteCollection.article_sources %}
                <option value="{{source.id}}" {% if article and article.source_id==source.id %} selected {%end%}  >{{source.name}}</option>
                {% end %}
            </select>
            <input class="submit-article-title" id="title" name="title" required="" type="text"
                   value="{% if article %} {{article.title}} {%end%}">（1-50字）
        </div>
        <div class="form-group">
            <label class="control-label" for="types">博文分类</label>：
            <select id="types" name="articleType_id">
                {% for at in article_types %}
                <option value="{{at.id}}" {% if article and article.articleType_id==at.id %} selected {%end%} >{{at.name}}</option>
                {% end %}
            </select>
        </div>
        <div class="form-group">
            <textarea id="content" class="markdown-edit" name="content">{% if article %}{% raw article.content %}{%end%}</textarea>
        </div>
        <div class="form-group">
            <label class="control-label" for="summary">博文摘要</label>（显示在博客首页,不填的话,默认取文章前120个字）<br>
            <textarea class="submit-article-summary form-control" id="summary" name="summary" >{% if article %}{{article.summary}}{%end%}</textarea>
        </div>
        <div class="submit-article-button">
            <button type="submit" class="btn btn-success">提交</button>
        </div>
    </form>
</div>
{% end %}

{% block private_script %}
    <!--<script src="//cdn.bootcss.com/markdown.js/0.5.0/markdown.min.js"></script>-->
    <script src="{{ static_url('js/markdown/markdown.js') }}"></script>
    <script src="{{ static_url('js/highlight/highlight.min.js') }}"></script>
    <script src="{{ static_url('js/markdown/to-markdown.js')}}"></script>
    <script src="{{ static_url('js/markdown/bootstrap-markdown.js')}}"></script>
    <script src="{{ static_url('js/markdown/locale/bootstrap-markdown.zh.js')}}"></script>
    <script src="{{ static_url('js/markdownEdit.js')}}"></script>
{% end %}